#pragma once

#include "TimeZone.h"

/*	tz_index is taken from the registry. Use TimeZone::TimeZone::enumZones to obtain it.
	local_time stands for local for that time zone time.
*/

namespace TimeZone
{
	class Bias
	{
		//	types

		//	data

		int					m_tz_index;
		TimeZone			m_tz;

		bool				m_cache_is_valid;
		int					m_cached_bias_sec;
		Time				m_started_at;
		Time				m_expired_at;
		int					m_started_at_utc;
		int					m_expired_at_utc;
		
		//	methods

		void				_reload(const Time& local_time);
		void				_reload(int utc);

	public:
		Bias(int tz_index);
		~Bias();

		int					biasSeconds(const Time& local_time);
		int					biasSeconds(int utc);
	};
}